import socket

phone = socket.socket()

phone.connect(('127.0.0.1', 8888))

# 发消息
while 1:
    cmd = input('>>>').strip()
    phone.send(cmd.encode('utf-8'))
    # 接收消息
    result = phone.recv(1024)  # 夯住,等待服务端的数据传过来
    print(result.decode('gbk'))

# 关机
phone.close()


